<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html lang="en">
  <head>
  	<base href="<%=basePath%>">
  	<!-- jsp文件头和头部 -->
  	<%@ include file="../../system/admin/top.jsp"%> 
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>病历列表</title>
    <script src="static/js/jquery-1.11.3.js"></script>
    <script src="static/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="static/js/bootbox.min.js"></script>
    <script type="text/javascript">
			$(top.hangge());
			//详情
			function detail(cfId){
				 top.jzts();	//显示加载进度
				 var diag = new top.Dialog();
				 diag.Drag=true;
				 diag.Title ="详情";
				 diag.URL = '<%=basePath%>cfOrder/findByCfId?id=' + cfId ;
		 		 diag.Width = 1000;
				 diag.Height = 800; 
			 	 diag.CancelEvent = function(){ //关闭事件
					 if(diag.innerFrame.contentWindow.document.getElementById('row').style.display == 'none'){
						 if('${page.currentPage}' == '0'){
							 top.jzts();
							 setTimeout("self.location=self.location",100);
						 }else{
							 nextPage(${page.currentPage});
						 }
					 }
					 diag.close();
			     };
			     diag.show();
			}
			
				//删除
		function deleteCf(_id){
			 bootbox.confirm("确定要删除吗?", function(result) {
				if(result) {
					top.jzts();
					var url = "<%=basePath%>cfOrder/deleteOne?id="+_id;
					$.get(url,function(data){
						top.jzts();
						setTimeout("self.location=self.location",100);
						nextPage('${page.currentPage}');
					}); 
					<%-- top.jzts();
					$.ajax({
							type: "POST",
							url: "<%=basePath%>cfOrder/deleteOne",
					    	data: {id:_id},
							dataType:'json',
							//beforeSend: validateData,
							cache: false,
							success: function(data){
								console.info(data);
								 if(data.msg=="success"){
								 	alert("删除成功");
								 	$(top.hangge());
								 //	window.location.reload(true);
								 	nextPage(${page.currentPage});
								 }else{
								 	alert(data.msg);
								 	$(top.hangge());
								 //	window.location.reload(true);
								 }
							}
						}); --%>
				}
			}); 
		}
			
	</script>
	<style>
		.table-striped {
			margin-top:10px;
		}
    	.table th,
    	.table td {
    		text-align:center;
    		vertical-align: middle;
    	}
	</style>
</head>
  <body>
  <form action="cfOrder/listByPid.do" method="post" name="Form" id="Form">
  	<input type="hidden" name="hzId" value="${pd.hzId}">
  
    <div class="container-fluid" style="padding-left:0;padding-right:35px;">
        <table id="table_report" class="table table-striped table-bordered table-hover">
				<thead>
					<tr>
						<th class="center">
						<label><input type="checkbox" id="zcheckbox" /><span class="lbl"></span></label>
						</th>
						<th>序号</th>
						<th>姓名</th>
						<th>电话</th>
						<!-- <th>处方编号</th> -->
						<!-- <th>病历编号</th> -->
						<th>主诉/现病史</th>
						<th>药品金额</th>
						<th>治疗费用</th>
						<th>合计金额</th>
						<th>医师姓名</th>
						<th>录入时间</th>
						<th class="center">操作</th>
					</tr>
				</thead>
				<tbody>
				<!-- 开始循环 -->	
				<c:choose>
					<c:when test="${not empty cfOrderList}">
						<c:forEach items="${cfOrderList}" var="cfOrder" varStatus="vs">
							<tr>
								<td class='center' style="width: 30px;">
									<label><input type='checkbox' disabled="disabled" /><span class="lbl"></span></label>
								</td>
								<td class='center' style="width: 30px;">${vs.index+1}</td>
								<td>${cfOrder.name }</td>
								<td>${cfOrder.phone }</td>
								<%-- <td>${cfOrder.cfdcode }</td> --%>
								<%-- <td>${cfOrder.bldcode }</td> --%>
								<td>${cfOrder.xbs }</td>
								<td>${cfOrder.ypprice }</td>
								<td>${cfOrder.zlprice }</td>
								<td>${cfOrder.totalprice }</td>
								<td>${cfOrder.USERNAME }</td>
								<td>${cfOrder.createdate }</td>
								<td style="width:100px;">
									<a class="btn btn-mini btn-success" onclick="detail(${cfOrder.id});">详情</a>
									<a class="btn btn-mini btn-danger" onclick="deleteCf(${cfOrder.id});">删除</a>
								</td>
							</tr>
						</c:forEach>
					</c:when>
					<c:otherwise>
						<tr class="main_info">
							<td colspan="10" class="center">没有相关数据</td>
						</tr>
					</c:otherwise>
				</c:choose>
				</tbody>
			</table>
			<div class="page-header position-relative">
		<table style="width:100%;">
			<tr>
				<!-- <td style="vertical-align:top;"><a class="btn btn-small btn-success" onclick="add();">新增</a></td> -->
				<td style="vertical-align:top;"><div class="pagination" style="float: right;padding-top: 0px;margin-top: 0px;">${page.pageStr}</div></td>
			</tr>
		</table>
		</div>
    </div>
    </form>
  </body>
</html>
